﻿using System;
using ApplicationLibrary.SqlConnector;

namespace Plumber.Sales.ModuleData
{
    #region PL_SalesInvoices

    public class PL_SalesInvoices : Table
    {
        public static string Name = "PL_SalesInvoices";
        public static Column<InvoiceType> InvoiceType = new Column<InvoiceType>(Name, Properties.Resources.T_InvoiceType, "InvoiceType", false, false);
        public static Column<string> InvoiceNo = new Column<string>(Name, Properties.Resources.T_SalesNo, "SalesNo", LEN.LONG_CODE, false, false);
        public static Column<DateTime> ReleaseDate = new Column<DateTime>(Name, Properties.Resources.T_ReleaseDate, "ReleaseDate");
        public static Column<string> Type = new Column<string>(Name, Properties.Resources.T_Type, "Type", LEN.SHORT_CODE);
        public static Column<string> Master = new Column<string>(Name, Properties.Resources.T_Master, "Master", LEN.LONG_CODE);
        public static Column<string> Title = new Column<string>(Name, Properties.Resources.T_Title, "Title", LEN.CODE);
        public static Column<string> Description = new Column<string>(Name, Properties.Resources.T_Description, "Description", 64);
        public static Column<string> Address = new Column<string>(Name, Properties.Resources.T_Address, "Address", 128);
        public static Column<string> ZipCode = new Column<string>(Name, Properties.Resources.T_ZipCode, "ZipCode", 5);
        public static Column<string> City = new Column<string>(Name, Properties.Resources.T_City, "City", LEN.DESCRIPTION);
        public static Column<string> County = new Column<string>(Name, Properties.Resources.T_County, "County", 2);
        public static Column<string> TaxNo = new Column<string>(Name, Properties.Resources.T_TaxNo, "TaxNo", 11);
        public static Column<string> FiscalCode = new Column<string>(Name, Properties.Resources.T_FiscalCode, "FiscalCode", 16);
        public static Column<string> Administrator = new Column<string>(Name, Properties.Resources.T_Administrator, "Administrator", LEN.LONG_CODE);
        public static Column<string> InvoiceBody = new Column<string>(Name, "", "InvoiceBody", 4000);

        public static Column<DateTime> PaymentDate = new Column<DateTime>(Name, Properties.Resources.T_PaymentDate, "PaymentDate");
        public static Column<bool> SalePayed = new Column<bool>(Name, Properties.Resources.T_SalePayed, "SalePayed");
        public static Column<double> AmountPayed = new Column<double>(Name, "", "AmountPayed");
        public static Column<bool> PrintEnvelope = new Column<bool>(Name, Properties.Resources.T_PrintEnvelope, "PrintEnvelope");

        public static Column<double> Amount = new Column<double>(Name, "", "Amount");
        public static Column<double> Total = new Column<double>(Name, "", "Total");
        public static Column<double> Tax = new Column<double>(Name, "", "Tax");
        public static Column<string> TaxCode = new Column<string>(Name, "", "TaxCode", LEN.SHORT_CODE);

        public static Column<bool> Restraint = new Column<bool>(Name, Properties.Resources.T_SalePayed, "Restraint");
        public static Column<string> RestraintCode = new Column<string>(Name, "", "RestraintCode", LEN.SHORT_CODE);
        public static Column<double> RestraintAmount = new Column<double>(Name, "", "RestraintAmount");

        public static Column<bool> Deduction = new Column<bool>(Name, "", "Deduction");
        public static Column<double> DeductionAmount = new Column<double>(Name, "", "DeductionAmount");
        public static Column<bool> BankRestraint = new Column<bool>(Name, "", "BankRestraint");
        public static Column<double> BankRestraintAmount = new Column<double>(Name, "", "BankRestraintAmount");

        public static Column<string> InvoiceRef = new Column<string>(Name, "", "InvoiceRef", LEN.LONG_CODE);
        public static Column<double> CreditNoteAmount = new Column<double>(Name, "", "CreditNoteAmount");

        public override iColumn ForeignKey
        {
            get { return InvoiceNo; }
        }

        public PL_SalesInvoices()
        {
            VisibleInRadar(new iColumn[] { InvoiceType, InvoiceNo, Type, Master, Description, Address, Administrator });
            Tablename = Name;
            DefineKey(new iColumn[] { InvoiceType, InvoiceNo });
        }
    }

    #endregion

    #region PL_Sentences

    public class PL_Sentences : Table
    {
        public static string Name = "PL_Sentences";

        public static Column<int> ID = new Column<int>(Name, "", "ID", false, true);
        public static Column<string> Title = new Column<string>(Name, Properties.Resources.T_Title, "Title", 21);
        public static Column<string> Text = new Column<string>(Name, "", "Text", 1024);

        public override iColumn ForeignKey
        {
            get { return ID; }
        }

        public PL_Sentences()
        {
            VisibleInRadar(new iColumn[] { ID, Title });
            Tablename = Name;
            DefineKey(new iColumn[] { ID });
        }
    }

    #endregion

    #region PL_Templates

    public class PL_Templates : Table
    {
        public static string Name = "PL_Templates";

        public static Column<TemplateType> Type = new Column<TemplateType>(Name, "", "Type", false, false);
        public static Column<string> Code = new Column<string>(Name, Properties.Resources.T_Code, "Code", LEN.LONG_CODE, false, false);
        public static Column<string> Description = new Column<string>(Name, Properties.Resources.T_Description, "Description", LEN.DESCRIPTION);
        public static Column<string> Body = new Column<string>(Name, "", "Body", 4000);
        public static Column<string> Combine = new Column<string>(Name, "", "Combine", 2048);

        public override iColumn ForeignKey
        {
            get { return Code; }
        }

        public PL_Templates()
        {
            VisibleInRadar(new iColumn[] { Code });
            Tablename = Name;
            DefineKey(new iColumn[] { Type, Code });
        }
    }

    #endregion

    #region PL_Quotations

    public class PL_Quotations : Table
    {
        public static string Name = "PL_Quotations";
        public static Column<string> QuotationNo = new Column<string>(Name, Properties.Resources.T_QuotationNo, "QuotationNo", LEN.LONG_CODE, false, false);
        public static Column<DateTime> ReleaseDate = new Column<DateTime>(Name, Properties.Resources.T_ReleaseDate, "ReleaseDate");
        public static Column<string> Type = new Column<string>(Name, Properties.Resources.T_Type, "Type", LEN.SHORT_CODE);
        public static Column<string> Master = new Column<string>(Name, Properties.Resources.T_Master, "Master", LEN.LONG_CODE);
        public static Column<string> Title = new Column<string>(Name, Properties.Resources.T_Title, "Title", LEN.CODE);
        public static Column<string> Description = new Column<string>(Name, Properties.Resources.T_Description, "Description", 64);
        public static Column<string> Address = new Column<string>(Name, Properties.Resources.T_Address, "Address", 128);
        public static Column<string> ZipCode = new Column<string>(Name, Properties.Resources.T_ZipCode, "ZipCode", 5);
        public static Column<string> City = new Column<string>(Name, Properties.Resources.T_City, "City", LEN.DESCRIPTION);
        public static Column<string> County = new Column<string>(Name, Properties.Resources.T_County, "County", 2);
        public static Column<string> TaxNo = new Column<string>(Name, Properties.Resources.T_TaxNo, "TaxNo", 11);
        public static Column<string> FiscalCode = new Column<string>(Name, Properties.Resources.T_FiscalCode, "FiscalCode", 16);
        public static Column<string> Administrator = new Column<string>(Name, Properties.Resources.T_Administrator, "Administrator", LEN.LONG_CODE);
        public static Column<string> QuotationBody = new Column<string>(Name, "", "QuotationBody", 4000);
        public static Column<string> Note = new Column<string>(Name, "", "Note", 256);

        public override iColumn ForeignKey
        {
            get { return QuotationNo; }
        }

        public PL_Quotations()
        {
            VisibleInRadar(new iColumn[] { QuotationNo, Type, Master, Description, Address, Administrator });
            Tablename = Name;
            DefineKey(new iColumn[] { QuotationNo });
        }
    }

    #endregion
}